package com.issc.framework.util;

import java.lang.reflect.Method;

public class Handler {
    private Class<?> controllerClass;
    private Method handlerMethod;

    public Handler(Class<?> controllerClass, Method handlerMethod) {
        this.controllerClass = controllerClass;
        this.handlerMethod = handlerMethod;
    }

    public Class<?> getControllerClass() {
        return controllerClass;
    }

    public void setControllerClass(Class<?> controllerClass) {
        this.controllerClass = controllerClass;
    }

    public Method getHandlerMethod() {
        return handlerMethod;
    }

    public void setHandlerMethod(Method handlerMethod) {
        this.handlerMethod = handlerMethod;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Handler handler = (Handler) o;

        if (!controllerClass.equals(handler.controllerClass)) return false;
        return handlerMethod.equals(handler.handlerMethod);
    }

    @Override
    public int hashCode() {
        int result = controllerClass.hashCode();
        result = 31 * result + handlerMethod.hashCode();
        return result;
    }
}
